#include <iostream>

using namespace std;

int main()
{
    int temp[] = {1, 2, 2, 3, 3, 4, 4, 4, 4, 8, 8, 6, 6, 6, 6, 5};
    int eor1 = 0;
    for (int i = 0; i < (int)(sizeof(temp) / sizeof(temp[1])); i++)
    {
        eor1 = eor1 ^ temp[i];
    }
    int lastPos1 = eor1 & (~eor1 + 1);
    int eor2 = 0;
    for (int i = 0; i < (int)(sizeof(temp) / sizeof(temp[1])); i++)
    {
        if ((temp[i] & lastPos1) != 0)
        {
            eor2 = eor2 ^ temp[i];
        }
    }

    cout << eor2 << endl;
    cout << (eor2 ^ lastPos1) << endl;
    system("pause");
    return 0;
}